<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="lib/react.development.js"></script>
    <script src="lib/react-dom.development.js"></script>
    <script src="lib/babel.min.js"></script>
    <script src="lib/prop-types.min.js"></script>
</head>
<body>
    <div id="root"></div>
    <script type="text/babel">
     let {Component} = React

    class Tick extends Component{
        constructor(){
            super();

            this.state = {
                time: new Date()
            };

            setInterval(()=>{
                this.setState({
                    time:new Date()
                })
            },1000)
        }

        render(){
            return (<div>
                <h2>时钟</h2>
                <div>{this.state.time.toLocaleTimeString()}</div>  
            </div>)
        }
    }

    ReactDOM.render(
        <Tick />,
        document.querySelector('#root')
    )

    </script>
</body>
</html>